﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ClockInLearning.Db
{
    public class AppDbContext : DbContext
    {
        // 由服务注入配置，而非自己定义
        public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
        {
        }

        public DbSet<UserInfo> UserInfos { get; set; }
        public DbSet<TokenInfo> Tokens { get; set; }
        public DbSet<UserRelation> UserRelations { get; set; }
        public DbSet<PointsRegistRecord> PointsRegistRecords { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<UserInfo>();
            modelBuilder.Entity<TokenInfo>();
            modelBuilder.Entity<UserRelation>();
            modelBuilder.Entity<PointsRegistRecord>();
        }
    }
}
